package com.easyOrder.service.enums;

/**
 * Created by liutao on 2017/7/17.
 */

import org.apache.commons.lang.StringUtils;


public enum RongCloudAPI {

    getToken("https://api.cn.ronghub.com/user/getToken.json", "获取token"),
    privateMessage("https://api.cn.ronghub.com/message/private/publish.json", "发送单聊消息"),
    ;

    private String url;

    private String desc;

    private RongCloudAPI(String url, String desc) {
        this.url = url;
        this.desc = desc;
    }

    public String getUrl() {
        return url;
    }

    public void setValue(String url) {
        this.url = url;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static RongCloudAPI parse(String url) {
        if (StringUtils.isBlank(url)) {
            return null;
        }
        RongCloudAPI[] coll = values();
        for (RongCloudAPI item : coll) {
            if (item.getUrl().equals(url)) {
                return item;
            }
        }
        return null;
    }
}

